// ===============================================
// location_data
// 
// Create by Will on 2020/10/16 3:05 PM
// Copyright @data_food.All rights reserved.
// ===============================================

import 'package:auto_route/auto_route.dart';
import 'package:json_annotation/json_annotation.dart';

/// This allows the `LocationData` class to access private members in
/// the generated file. The value for this is *.g.dart, where
/// the star denotes the source file name.
part 'location_data.g.dart';

/// An annotation for the code generator to know that this class needs the
/// JSON serialization logic to be generated.
@JsonSerializable()
class LocationData {
  final double lat;
  final double lng;
  final String title;
  final String address;

  const LocationData({
    @required this.lat,
    @required this.lng,
    this.title,
    this.address,
  });

  /// A necessary factory constructor for creating a new LocationData instance
  /// from a map. Pass the map to the generated `_$LocationDataFromJson()` constructor.
  /// The constructor is named after the source class, in this case, LocationData.
  factory LocationData.fromJson(Map<String, dynamic> json) =>
      _$LocationDataFromJson(json);

  /// `toJson` is the convention for a class to declare support for serialization
  /// to JSON. The implementation simply calls the private, generated
  /// helper method `_$LocationDataToJson`.
  Map<String, dynamic> toJson() => _$LocationDataToJson(this);
}